import 'dart:math';

import 'package:flutter/cupertino.dart';

class WaveClipper extends CustomClipper<Path> {
  @override
  Path getClip(Size size) {
    var path = Path();
    path.lineTo(0.0, size.height);
    final mainAxis = pi / 3; // 控制波浪的宽度
    final waveAxis = pi; // 控制波浪的弯曲程度
    for (int i = 0; i <= size.width.toInt(); i++) {
      double dx = (i * 1.0);
      double dy = sin(dx / 10 + i) * 10.0; // 控制波浪的高度
      double val = dy;
      path.lineTo(dx, val);
    }
    path.lineTo(size.width, 0.0);
    path.close();
    return path;
  }

  @override
  bool shouldReclip(WaveClipper oldClipper) => false;
}